<?php
namespace  app\utils;
use Underscore\Types\Arrays;

class Lodash{


    static function  lodashExit($array,Closure $cb){
        $one=Arrays::find($array,$cb);
        return isset($one);
    }

    static function getRand(){
        $rand = rand(10000, 100000);
        return substr(base64_encode($rand), 0, 16);
    }

    static function  Map(&$array,$cb){
        $newArray = [];
        for ($i = 0; $i < count($array); $i++) {
            array_push($newArray,  $cb($array[$i], $i));
        }
        return $newArray;
    }
    static function  ForEach(&$array,  $cb){
        for ($i = 0; $i < count($array); $i++) {
            $cb($array[$i], $i);
        }
    }


}